package org.yyjkcache.common;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesHandler {
	/**
	 * 获取根目录下的properties文件中的某个键所对应的值
	 * @param file  文件夹相对根路径的地址--不能以“/” 开头
	 * @return
	 */
	public static Properties getValueOnRoot(String file) {
		Properties properties = new Properties();
		InputStream ins = null;
		try {
			ins = JedisLinkedPool.class.getClassLoader().getResourceAsStream(file);
			properties.load(ins);
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (null != ins) {
				try {
					ins.close();
					ins = null;
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return properties;
	}
}
